package com.hnguigu.health.houduan.jpx.controller_jpx;

import com.hnguigu.health.houduan.jpx.service_jpx.TCheckGroupService;
import com.hnguigu.health.houduan.jpx.service_jpx.TSetmealCheckgroupSer;
import com.hnguigu.health.pojo.TCheckgroup;
import com.hnguigu.health.pojo.TSetmealCheckgroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/TSetmealCheckgroupController")
public class TSetmealCheckgroupController {
    @Autowired(required = false)
    TSetmealCheckgroupSer tSetmealCheckgroupSer;
    @Autowired(required = false)
    TCheckGroupService tCheckGroupService;

    //1.2A t`套餐检查分组关联表 根据不同套餐的id查,展示套餐名,一些项目名称,项目解读
    @PostMapping("/TSetmealCheckgroupA/{setmealId}")
    @ResponseBody
    public List<TSetmealCheckgroup> hashCode(@PathVariable Integer setmealId) {
        List<TSetmealCheckgroup> tSetmealCheckgroupS = tSetmealCheckgroupSer.TSetmealCheckgroupA(setmealId);
        return tSetmealCheckgroupS;
    }

    //1.2B 根据id数组展示项目内容
    @RequestMapping("/allGroupBycheckgroupId/{setmealId}")
    @ResponseBody
    public List<TCheckgroup> allGroupBycheckgroupId(@PathVariable Integer setmealId) {
        List<TCheckgroup> tCheckgroups = tCheckGroupService.allGroupBycheckgroupId(setmealId);
        System.out.println(tCheckgroups+"------------------");
        return tCheckgroups;
    }
}
